/*
	관련파일 : arrayEx.html
	내용 : Array 예제
	작성자: hgh
	작성일: 13.09.30
*/

function even()
{
	var jBtn = document.getElementById('jjacBtn');
	var number = [1,2,3,4,5,6];
	var rejnum='';
	var rehnum='';
	var i=0;
	jBtn.onclick = function()
	{
		rejnum='';
		rehnum='';
		for(i=0;i<number.length;i++)
		{
			if(number[i]%2==0)
			{
				rejnum += " " + number[i];
			}
			else
			{
				rehnum += " " + number[i];
			}
		};
		document.getElementById('numResult').innerHTML = "짝수 : " + rejnum + "<br>홀수 : " + rehnum;
	};
};

function star()
{
	var stBtn = document.getElementById('starBtn');
	var tot = new Array(4,3,2,5,6,4);
	var i=0;
	var j=0;
	var str='';
	stBtn.onclick = function()
	{
		str='';
		for(i=0;i<tot.length;i++)
		{
			for(j=0;j<tot[i];j++)
			{
				str += '*';
				if(j==tot[i]-1)
				{
					str += "(" + tot[i] + ")" + "<br>";
				}
			}
		};
		document.getElementById('starResult').innerHTML = str;
	};
};